package com.huawei.petSystemdemo.adapter;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.huawei.petSystemdemo.R;
import com.huawei.petSystemdemo.bean.Adress;
import com.huawei.petSystemdemo.bean.Commentpet;
import com.huawei.petSystemdemo.change_shopping_adress_Activity;
import com.huawei.petSystemdemo.ui.mOrder.OrderSureActivity;
import com.huawei.petSystemdemo.ui.pet.Detail_page_Activity;
import com.huawei.petSystemdemo.utils.ImgRepository;
import com.huawei.petSystemdemo.utils.OnBindBottomListener;
import org.w3c.dom.Comment;
import java.util.List;
import java.util.function.Consumer;

public class CommentAdapter extends RecyclerView.Adapter<CommentAdapter.CommentViewHolder> {
    List<Commentpet> CommentList;
    Context context;

    public CommentAdapter(List<Commentpet> CommentList, Context context) {
        this.CommentList = CommentList;
        this.context = context;

    }

    public class CommentViewHolder extends RecyclerView.ViewHolder {
        ImageView vip_icon;
        TextView commentname;
        TextView commentcontent;

        public CommentViewHolder(@NonNull View itemView) {
            super(itemView);
            commentcontent = itemView.findViewById(R.id.commentcontent);
            commentname = itemView.findViewById(R.id.commentname);//shopping_adress_detaillocation
        }
    }

    @NonNull
    @Override
    public CommentAdapter.CommentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.discuss_pet, parent, false);
        return new CommentAdapter.CommentViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull CommentAdapter.CommentViewHolder holder, int position) {
        Commentpet comment = CommentList.get(position);

        //holder.img.setImageResource(R.drawable.cat);
        holder.commentname.setText(comment.getPerson() + "");
        holder.commentcontent.setText(comment.getContent() + "");


    }

    @Override
    public int getItemCount() {
        return CommentList.size();
    }

}
